let t = require;
let e = module;
let o = e.exports;
o.default = e.exports;

('use strict');
console.log('start');
var _n127,
  i =
    (this && this.__extends) ||
    ((_n127 = function n(t, e) {
      return (_n127 =
        Object.setPrototypeOf ||
        ({
          __proto__: []
        } instanceof Array &&
          function (t, e) {
            t.__proto__ = e;
          }) ||
        function (t, e) {
          for (var o in e) {
            Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
          }
        })(t, e);
    }),
    function (t, e) {
      function o() {
        this.constructor = t;
      }
      _n127(t, e),
        (t.prototype =
          null === e
            ? Object.create(e)
            : ((o.prototype = e.prototype), new o()));
    }),
  r =
    (this && this.__decorate) ||
    function (t, e, o, n) {
      var i,
        r = arguments.length,
        a =
          r < 3
            ? e
            : null === n
            ? (n = Object.getOwnPropertyDescriptor(e, o))
            : n;
      if (
        'object' ==
          (typeof Reflect === 'undefined' ? 'undefined' : typeof Reflect) &&
        'function' == typeof Reflect.decorate
      )
        a = Reflect.decorate(t, e, o, n);
      else
        for (var s = t.length - 1; s >= 0; s--) {
          (i = t[s]) &&
            (a = (r < 3 ? i(a) : r > 3 ? i(e, o, a) : i(e, o)) || a);
        }
      return r > 3 && a && Object.defineProperty(e, o, a), a;
    };
Object.defineProperty(o, '__esModule', {
  value: !0
}),
  (o.MilitaryPanel = void 0);
var a = t('UIViewRes'),
  s = t('UILayer'),
  c = t('AbsMainPanel'),
  l = t('ComUtils'),
  u = t('SoundMrg'),
  h = t('SoldierCfg'),
  p = t('ResMrg'),
  f = t('MilitaryItemCom'),
  d = t('MilitaryMrg'),
  g = t('LangCfg'),
  _ = cc._decorator,
  y = _.ccclass,
  C =
    (_.property,
    (function (t) {
      function e() {
        return (null !== t && t.apply(this, arguments)) || this;
      }
      var o;
      return (
        i(e, t),
        (o = e),
        (e.prototype.onInit = function () {
          t.prototype.onInit.call(this),
            (this._index = 1),
            (this._stage = l.default.getNode(this.view, 'dibantu/stage')),
            (this._txtName = l.default.getComponent(
              cc.Label,
              this.view,
              'dibantu/wenmingdiban/txtName'
            )),
            (this._imgType = l.default.getComponent(
              cc.Sprite,
              this.view,
              'dibantu/wenmingdiban/imgType'
            )),
            (this._txtType = l.default.getComponent(
              cc.Label,
              this.view,
              'dibantu/wenmingdiban/imgType/txtType'
            )),
            (this._btnLeft = l.default.getComponent(
              cc.Button,
              this.view,
              'dibantu/btnLeft'
            )),
            this._btnLeft.node.on(
              cc.Node.EventType.TOUCH_END,
              this.onTouchLeftHandler,
              this
            ),
            (this._btnRight = l.default.getComponent(
              cc.Button,
              this.view,
              'dibantu/btnRight'
            )),
            this._btnRight.node.on(
              cc.Node.EventType.TOUCH_END,
              this.onTouchRightHandler,
              this
            ),
            (this._items = []);
          for (var e = 0; e < 3; e++) {
            var o = l.default.getNode(
                this.view,
                'New Node/scrollView/view/content/item' + e
              ),
              n = new f.MilitaryItemCom(o);
            this._items.push(n);
          }
          this.refresh();
        }),
        (e.prototype.onLang = function () {
          var t = h.SoldierCfg.ins.getDataByType(o.Types[this._index]);
          t &&
            ((this._txtName.string = g.LangCfg.ins.getContent(t.name)),
            (this._txtType.string = g.LangCfg.ins.getContent(t.kind)));
        }),
        (e.prototype.onTouchLeftHandler = function () {
          u.SoundMrg.click(),
            this._index > 0 && (this._index--, this.refresh());
        }),
        (e.prototype.onTouchRightHandler = function () {
          u.SoundMrg.click(),
            this._index < o.Types.length - 1 && (this._index++, this.refresh());
        }),
        (e.prototype.refresh = function () {
          var t = h.SoldierCfg.ins.getDataByType(o.Types[this._index]),
            e = this;
          t &&
            (cc.resources.load(
              'Prefab/Soldier/' + t.model,
              cc.Prefab,
              function (t, o) {
                if (!t) {
                  var n = cc.instantiate(o);
                  (n.scale = 0),
                    e._stage.removeAllChildren(),
                    e._stage.addChild(n),
                    cc
                      .tween(n)
                      .to(
                        0.2,
                        {
                          scale: 1
                        },
                        {
                          easing: 'elasticOut'
                        }
                      )
                      .start();
                }
              }
            ),
            this.onLang(),
            p.ResMrg.loadSpriteByAtlas(
              this._imgType,
              'Atlas/Military',
              'type' + t.type
            ));
          var n = d.MilitaryMrg.ins.getDataByType(t.type);
          if (n)
            for (var i = 0; i < n.length; i++) {
              this._items[i].data = n[i];
            }
          (this._btnRight.node.active = this._index < o.Types.length - 1),
            (this._btnLeft.node.active = this._index > 0);
        }),
        (e.RES = new a.UIViewRes(
          'Panel/MilitaryPanelView',
          'Main',
          s.UILayer.BackLayer
        )),
        (e.Types = [1, 2, 3]),
        (o = r([y('MilitaryPanel')], e))
      );
    })(c.AbsMainPanel));
(o.MilitaryPanel = C), console.log('end');
module.exports = e.exports;
